/*
 * Copyright (C) 2011-2016 Markus Junginger, greenrobot (http://greenrobot.org)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


package org.greenrobot.greendao.sample;

import org.greenrobot.greendao.annotation.Convert;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Index;
import org.greenrobot.greendao.annotation.NotNull;

import java.util.Date;

/**
 * Entity - Person.
 */
@Entity(indexes = {
    @Index(value = "name, date DESC", unique = true)
})
public class Person {
    private static final int HAS_NO = 1272611929;

    private static final int PERSON_HAS_NO = 1686394253;

    @Id
    private Long id;

    @NotNull
    private String name;

    private String comment;

    private String parent;

    private Date date;

    @Convert(converter = PersonTypeConverter.class, columnType = String.class)
    private PersonType type;

    /**
     * Person.
     */
    @Generated(hash = HAS_NO)
    public Person() {
    }

    /**
     * Person.
     *
     * @param id id
     */
    public Person(Long id) {
        this.id = id;
    }

    /**
     * Person.
     *
     * @param id id
     * @param name name
     * @param comment comment
     * @param parent parent
     * @param date date
     * @param type type
     */
    @Generated(hash = PERSON_HAS_NO)
    public Person(Long id, @NotNull String name, String comment, String parent, java.util.Date date, PersonType type) {
        this.id = id;
        this.name = name;
        this.comment = comment;
        this.parent = parent;
        this.date = date;
        this.type = type;
    }

    /**
     * getId
     *
     * @return Long
     */
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @NotNull
    public String getName() {
        return name;
    }

    /**
     * Not-null value; ensure this value is available before it is saved to the database.
     *
     * @param name text
     */
    public void setName(@NotNull String name) {
        this.name = name;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public String getParent() {
        return parent;
    }

    public void setParent(String parent) {
        this.parent = parent;
    }

    public PersonType getType() {
        return type;
    }

    public void setType(PersonType type) {
        this.type = type;
    }
}
